﻿@model IEnumerable<YogaStudio.Data.Domain.Category>

@{
    ViewBag.Title = "Index";
}

<div class="main">
    <div class="content">
        <div class="section group">
            <div class="col span_2_of_3">
                <div class="contact-form">
                    <p>
                        @if (TempData["Message"] != null)
                        {
                            <div style="color:green;" id="successMessage">@TempData["Message"]</div>
                            <script>
                                setInterval(function () {
                                    $("#successMessage").fadeOut("slow");
                                }, 2000);
                            </script>
                        }
                    </p>
                    <h3>Category List</h3>
                    
                <p>
                    @Html.ActionLink("Create New", "Create", null, new { @class = "btn" })
                </p>
                <div class="datagrid">
                    <table id="box-table-a">
                        <tr>
                            <th scope="col">
                                @Html.DisplayNameFor(model => model.CategoryName)
                            </th>
                            <th>
                                @Html.DisplayNameFor(model => model.CategoryDescription)
                            </th>
                            <th>
                                Action
                            </th>

                        </tr>

                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @Html.DisplayFor(modelItem => item.CategoryName)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.CategoryDescription)
                                </td>
                                <td>
                                    @Html.ActionLink("Edit", "Edit", new { id = item.CategoryId }) |
                                    @Html.ActionLink("Details", "Details", new { id = item.CategoryId }) |
                                    @Html.ActionLink("Delete", "DeleteConfirmed", new { id = item.CategoryId }, new { @class = "delete" })
                                    <script>
                                        $(".delete").click(function () {
                                            return confirm("Are you sure to delete?")
                                        }

                                        );
                                    </script>
                                </td>
                            </tr>
                        }

                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
